import urllib.parse
import urllib.request

url = 'https://kq.coupon.18qy.cn:8001/api/wxx/batchInfo'
data = {
    'pageSize': 10,
    'pageNum': 1
}
data = urllib.parse.urlencode(data).encode('utf-8')
header = {
    'token': '8c536c8116eb46feaab348d905a8fdad'
}

request = urllib.request.Request(url=url, data=data, headers=header)
response = urllib.request.urlopen(request)
content = response.read().decode('utf-8')
print(content)

# 写入到本地
with open('batch.json', 'w', encoding='utf-8') as fp:
    fp.write(content)
